#define _CRT_SECURE_NO_WARNINGS 1

  struct TreeNode {
 	int val;
 	struct TreeNode *left;
 	struct TreeNode *right;
 	TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
  };
 
class Solution {
public:
    void _Mirror(TreeNode* cur)
    {
        if (!cur) return;
        TreeNode* Lnode = cur->left, * Rnode = cur->right;
        TreeNode* tmp = cur->left;
        cur->left = cur->right;
        cur->right = tmp;
        _Mirror(Lnode);
        _Mirror(Rnode);
    }
    TreeNode* Mirror(TreeNode* pRoot)
    {
        _Mirror(pRoot);
        return pRoot;
    }
};